/* 最大流判定
* 1.解题思路 二分，最大流
    二分最长长度x，即只用考虑长度小于等于x的边，对这些边形成的图建立流网络，每条边的容量设为1，找1到n的最大流，即为不形成重边的路径数量
    对于流网络中的一个可行流，从1出发的所有流量一定最后都到达n，流过的边对应实际选择的路径，从1出发有多少流量就对应实际有多少条不重边的路径
    要求最大权值最小，那么我们二分最大权值k，建立所有权值≤k的边，跑最大流。若最大流的maxflow≥T则有解
*/

#define DEBUG
#pragma GCC optimize("O1,O2,O3,Ofast")
#pragma GCC optimize("no-stack-protector,unroll-loops,fast-math,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,ssse3")

#include <iostream>
#include <cstring>
using namespace std;

const int N = 210, M = 80010, INF = 0x3f3f3f3f;

int n, m, K;
int h[N], e[M], ne[M], c[M], f[M], idx;
int S, T;
int d[N], q[N], cur[N];

void AddEdge(int a, int b, int w)
{
    e[idx] = b, c[idx] = w, ne[idx] = h[a], h[a] = idx++;
    //e[idx] = a, c[idx] = 0, ne[idx] = h[b], h[b] = idx++;
}

bool bfs()
{
    memset(d, -1, sizeof d);
    int hh = 0, tt = -1;
    q[++tt] = S, d[S] = 0, cur[S] = h[S];
    while(hh <= tt)
    {
        int u = q[hh++];
        for(int i = h[u]; ~i; i = ne[i])
        {
            int v = e[i];
            if(d[v] == -1 && f[i])
            {
                d[v] = d[u]+1;
                cur[v] = h[v];
                if(v == T) return true;
                q[++tt] = v;
            }
        }
    }
    return false;
}   

int find(int u, int limit)
{
    if(u == T) return limit;
    int flow = 0;
    for(int i = cur[u]; ~i && flow < limit; cur[u] = i, i = ne[i])
    {
        int v = e[i];
        if(d[v] == d[u]+1 && f[i])
        {
            int t = find(v, min(limit - flow, f[i]));
            if(!t) d[v] = -1;
            f[i] -= t, f[i^1] += t, flow += t;
        }
    }
    return flow;
}

int Dinic()
{
    int r = 0, flow = 0;
    while(bfs())
        while(flow = find(S, INF)) r += flow; 
    return r;
}

bool check(int mid)
{
    for(int i = 0; i < idx; i++)
        f[i] = (c[i] <= mid); //大于限值则不考虑
    //printf("%d\n", Dinic());
    return Dinic() >= K;
    
}

signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
    #else
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    memset(h, -1, sizeof h);

    cin >> n >> m >> K;
    S = 1, T = n;

    for(int i = 1; i <= m; i++)
    {
        int a, b, c; cin >> a >> b >> c;
        AddEdge(a, b, c); AddEdge(b, a, c); 
    }

    int l = 1, r = 1e6+10;
    while(l < r)
    {
        int mid = l + r >> 1;
        //printf("%d %d %d\n", l, mid, r);
        if(check(mid)) r = mid; 
        else l = mid + 1;
    }
    printf("%d\n", r);
    return 0;
}